package edu.umd.ion.wavemeter.server;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import edu.umd.ion.wavemeter.service.InterlockSettings;


@SuppressWarnings("serial")
@Entity(name = "InterlockSettings")
@Table(name = "InterlockSettings") //Name of the entity
@NamedQueries({
    @NamedQuery(name="AllInterlockSettings",
        query="SELECT x FROM InterlockSettings x")
})
public class PersistentInterlockSettings implements Serializable, PersistentObject<Integer,PersistentInterlockSettings> {
	@Id
	@Column(name="channel")
	private Integer Channel;
	
	@Column(name="MinWavelength")
	private double MinWavelength;
	
	@Column(name="MaxWavelength")
	private double MaxWavelength;
	
	private boolean Enable;
	private int Serial;
	
	public void set(PersistentInterlockSettings r) {
		Channel = r.Channel;
		setMaxWavelength(r.getMaxWavelength());
		setMinWavelength(r.getMinWavelength());	
		Enable = r.Enable;
		Serial = r.Serial;
	}
	
	public void set(InterlockSettings r) {
		Channel = r.Channel;
		setMaxWavelength(r.MaxWavelength);
		setMinWavelength(r.MinWavelength);	
		Enable = r.Enable;
		Serial = r.Serial;
	}
	
	public InterlockSettings plain() {
		InterlockSettings r = new InterlockSettings();
		r.Channel = Channel;
		r.MaxWavelength = getMaxWavelength();
		r.MinWavelength = getMinWavelength();
		r.Enable = Enable;
		r.Serial = Serial;
		return r;
	}
	
	public Integer getPrimaryKey() {
		return Channel;
	}

	public int getChannel() {
		return Channel;
	}

	public void setChannel(int channel) {
		Channel = channel;
	}

	public void setMinWavelength(double minWavelength) {
		MinWavelength = minWavelength;
	}

	public double getMinWavelength() {
		return MinWavelength;
	}

	public void setMaxWavelength(double maxWavelength) {
		MaxWavelength = maxWavelength;
	}

	public double getMaxWavelength() {
		return MaxWavelength;
	}

	public boolean isEnable() {
		return Enable;
	}

	public void setEnable(boolean enable) {
		Enable = enable;
	}

	public int getSerial() {
		return Serial;
	}

	public void setSerial(int serial) {
		Serial = serial;
	}
		
}
